#include<bits/stdc++.h>
#define int long long
using namespace std;
#define getchar() (p1 == p2 && (p2 = (p1 = buf1) + fread(buf1, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
char buf1[1 << 23], *p1 = buf1, *p2 = buf1, ubuf[1 << 23], *u = ubuf;
namespace IO
{
	template<typename T>
	void read(T &_x){_x=0;int _f=1;char ch=getchar();while(!isdigit(ch)) _f=(ch=='-'?-1:_f),ch=getchar();while(isdigit(ch)) _x=_x*10+(ch^48),ch=getchar();_x*=_f;}
	template<typename T,typename... Args>
	void read(T &_x,Args&...others){Read(_x);Read(others...);}
	const int BUF=20000000;char buf[BUF],to,stk[32];int plen;
	#define pc(x) buf[plen++]=x
	#define flush(); fwrite(buf,1,plen,stdout),plen=0;
	template<typename T>inline void print(T x){if(!x){pc(48);return;}if(x<0) x=-x,pc('-');for(;x;x/=10) stk[++to]=48+x%10;while(to) pc(stk[to--]);}
}
using namespace IO;
const int N = 2e5+10;
int n,a[N],b[N],c[N],d[N],x,cnt,ans,mi,mx,l[N],r[N],ch[N],R;
inline void add(int x,int y){while(x <= cnt) c[x] = max(c[x],y),x += x&-x;}
inline void add_min(int x,int y){while(x <= cnt) c[x] = min(c[x],y),x += x&-x;}
inline int query(int x){int ans = 0; while(x) ans = max(ans,c[x]),x -= x&-x; return ans;}
inline int query_min(int x){int ans = n+1; while(x) ans = min(ans,c[x]),x -= x&-x; return ans;}
struct w
{
	int l,r,dat,z;
}f[N];
inline bool cmp(w x,w y){return x.dat>y.dat;}
signed main()
{
	freopen("min.in","r",stdin);
	freopen("min.out","w",stdout);
	read(n);
	for(int i = 1;i <= n;i++) read(a[i]);
	for(int i = 1;i <= n;i++) read(b[i]);
	if(n <= 5000)
	{
		for(int i = 1;i <= n;i++) c[i] = a[i],d[i] = b[i];
		for(int i = 1;i <= n;i++)
		{
			ans = 2e9;
			for(int j = n-i+1;j >= 1;j--) ans = min(ans,abs(c[j]-d[j]));
			for(int j = n-i;j >= 1;j--) c[j] = min(c[j],a[j+i]),d[j] = min(d[j],b[j+i]);
			print(ans),pc('\n');
		}
		flush();
		return 0;
	} mi = 1e11;
	for(int i = 1;i <= n;i++) mi = min(mi,b[i]),mx = max(mx,b[i]);
	if(mi == mx)
	{
		if(mi == 1)
		{
			mi = 1e11;
			for(int i = 1;i <= n;i++) mi = min(mi,a[i]);
			for(int i = 1;i <= n;i++) print(mi-1),pc('\n');
			flush();
			return 0;
		}
		else
		{
			for(int i = 1;i <= n;i++) d[++cnt] = a[i];
			sort(d+1,d+1+cnt); cnt = unique(d+1,d+1+cnt)-d-1;
			for(int i = 1;i <= n;i++) 
			{
				x = lower_bound(d+1,d+1+cnt,a[i])-d;
				l[i] = query(x-1),add(x,i);
			}
			for(int i = 1;i <= cnt;i++) c[i] = n+1; 
			for(int i = n;i >= 1;i--) 
			{
				x = lower_bound(d+1,d+1+cnt,a[i])-d;
				r[i] = query_min(x-1),add_min(x,i);
			}
			for(int i = 1;i <= n;i++) f[i].l = l[i],f[i].r = r[i],f[i].dat = a[i],f[i].z = i;
			sort(f+1,f+1+n,cmp); R = 1;
			for(int i = 1;i <= n;i++) 
			{
				x = f[i].r-f[i].l-1;
				for(int j = R;j <= x;j++) ch[j] = f[i].dat;
				R = max(R,x+1);
			}
			for(int i = 1;i <= n;i++) print(b[1]-ch[i]),pc('\n');
			flush();
		}
	}
	return 0;
}




